#include($$PWD/../defines.pri)

TEMPLATE = lib
TARGET = qmlvncviewer
QT += qml quick widgets
CONFIG += qt plugin c++11

TARGET = $$qtLibraryTarget($$TARGET)
uri = com.rooyeetone.vnc

win32 {
    DEFINES += _CRT_SECURE_NO_WARNINGS
    !contains(QMAKE_TARGET.arch, x86_64) {
        ARCH = Win32## Windows x86 (32bit) specific build here
    } else {
        ARCH = x64 ## Windows x64 (64bit) specific build here
    }

    CONFIG(debug, debug|release): BUILD = debug

    CONFIG(release, debug|release){
        BUILD=release
    }
}

QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.01

BASE_DESTDIR = $$PWD/../../build/vncviewer/$$BUILD

DESTDIR = $$BASE_DESTDIR\imports\com\rooyeetone\vnc

updateqm.commands = $$PWD\update.bat $$DESTDIR $$PWD
updateqm.target = updateqm

QMAKE_EXTRA_TARGETS += updateqm

PRE_TARGETDEPS += updateqm


# Input
SOURCES += \
    src/qmlvncviewer_plugin.cpp \
    src/qquickvncviewer.cpp \
    src/qvncvieweradapter.cpp \
    src/viewervncauthhandler.cpp \
    src/vnclogger.cpp \
    src/vncutils.cpp

HEADERS += \
    src/qmlvncviewer_plugin.h \
    src/qquickvncviewer.h \
    src/qvncvieweradapter.h \
    src/viewervncauthhandler.h \
    src/vnclogger.h \
    src/vncutils.h

DISTFILES = qmldir

!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
    copy_qmldir.target = $$OUT_PWD/qmldir
    copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
    copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
    QMAKE_EXTRA_TARGETS += copy_qmldir
    PRE_TARGETDEPS += $$copy_qmldir.target
}

qmldir.files = qmldir
unix {
    installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
    qmldir.path = $$installPath
    target.path = $$installPath
    INSTALLS += target qmldir
}


DEFINES += _UNICODE

#INCLUDEPATH += $$PWD/../tightvnc


#message($$PWD/tightvnc/$${BUILD})

#win32-msvc*:LIBS += -lkernel32 -luser32 -lgdi32 -lole32 -lshell32 -ladvapi32 -limm32 -lwinspool
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/client-config-lib
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/config-lib
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/file-lib
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/ft-client-lib
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/ft-common
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/gui
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/io-lib
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/log-writer
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/network
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/region
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/rfb
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/thread
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/util
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/viewer-core
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/tcp-dispatcher
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/win-system
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/zlib
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64old/$${BUILD}/libjpeg
INCLUDEPATH +=$$PWD/../tightvnc-2.8.59-gpl/
win32-msvc*:LIBS += -lkernel32 -luser32 -lgdi32 -lole32 -lshell32 -ladvapi32 -limm32 -lwinspool
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/client-config-lib
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/config-lib
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/file-lib
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/ft-client-lib
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/ft-common
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/gui
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/io-lib
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/log-writer
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/network
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/region
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/rfb
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/thread
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/util
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/viewer-core
#win32-msvc*:LIBS += -l$$PWD/../tightvncOld/x64/$${BUILD}/tcp-dispatcher
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/win-system
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/zlib
win32-msvc*:LIBS += -l$$PWD/../tightvnc-2.8.59-gpl/x64/Release/libjpeg
QMAKE_CXXFLAGS_RELEASE += /MT
QMAKE_CFLAGS_RELEASE += /MT
QMAKE_CXXFLAGS_DEBUG += /MTd
QMAKE_CFLAGS_DEBUG += /MTd

